<?php

namespace Common\Model;

class UserRoomModel extends BaseModel {

    protected $trueTableName = 'tb_user_room';

    /**
     * 获取信息
     * @param integer $id ID
     * @return type
     */
    public function getInfoById($id) {
        $option = [
            'id'=> $id,
        ];
        $data = $this->field('*')->where($option)->find();        
        return empty($data) ? array() : $data;
    }
    
    public function addInfo($data)
    {
        return $this->add($data);
    }    
    
    public function getOrderUserList($orderRoomId)
    {
        $option = [
            'orderroom_id'=> $orderRoomId,
        ];
        $data = $this->field('userlogin_id, orderroom_id, orderuser_id, startdate, enddate')->where($option)->select();
        return empty($data) ? array() : $data;
    }  

    public function updateInfo($data, $where)
    {
        return $this->where($where)->data($data)->save();
    }
}
